package com.zhouyer.study;

import com.zhouyer.study.bean.ConsumerComponent;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

import java.io.IOException;

/**
 * 消费者启动类
 *
 * @author zhouyao
 * @version 1.0
 * @date 2021/11/22 8:27 下午
 */
public class DubboTpConsumerMain {
    public static void main(String[] args) throws IOException {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConsumerConfiguration.class);
        context.start();
        ConsumerComponent server = context.getBean(ConsumerComponent.class);
        while (true) {
            String res1 = server.methodA("zhouyer");
            //System.out.println(res1);

            String res2 =server.methodB("zhouyer");
            //System.out.println(res2);

            String res3 =server.methodC("zhouyer");
            //System.out.println(res3);
        }
    }

    @Configuration
    @ComponentScan(value = "com.zhouyer.study.bean")
    @EnableDubbo
    @PropertySource("classpath:dubbo-consumer.properties")
    static class ConsumerConfiguration {

    }
}
